﻿using DongFangGuoKai.TaskPlatform.Commn;
using DongFangGuoKai.TaskPlatform.Commn.IOCTag;
using DongFangGuoKai.TaskPlatform.Core.Repositorys;
using DongFangGuoKai.TaskPlatform.Domain;
using SqlSugar;
using System.Linq.Expressions;

namespace DongFangGuoKai.TaskPlatform.Service.LogApp
{
    public partial class LogService : ILogService, ITransientTag
    {
        public Repository<Nlog> _logRepo { get; set; }

        public async Task<ApiDataResult<List<Nlog>>> GetLogListAsync(int pageIndex, int pageSize, Expression<Func<Nlog, bool>> expression)
        {
            var pageModel = new PageModel() { PageIndex = pageIndex, PageSize = pageSize };
            var logList = await _logRepo
                .GetPageListAsync(expression, pageModel, x => x.Id, OrderByType.Desc);
            ApiDataResult<List<Nlog>> result = new ApiDataResult<List<Nlog>>()
            {
                Data = logList,
                Count = pageModel.TotalCount,
                Success = true,
                Message = "日志分页查询"
            };
            return result;
        }


    }
}
